home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / Test::Harness.z / Test::Harness
Encoding:
Text File  |  1998-10-30  |  5.0 KB  |  199 lines

  1.  
  2.  
  3.  
  4. TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))                                              TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Test::Harness - run perl standard test scripts with statistics
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      use Test::Harness;
  13.  
  14.      _r_u_n_t_e_s_t_s(@tests);
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      Perl test scripts print to standard output "ok N" for each single test,
  18.      where N is an increasing sequence of integers. The first line output by a
  19.      standard test script is "1..M" with M being the number of tests that
  20.      should be run within the test script. _T_e_s_t::_H_a_r_n_e_s_s::_r_u_n_t_e_s_t_s(@tests)
  21.      runs all the testscripts named as arguments and checks standard output
  22.      for the expected "ok N" strings.
  23.  
  24.      After all tests have been performed, _r_u_n_t_e_s_t_s() prints some performance
  25.      statistics that are computed by the Benchmark module.
  26.  
  27.      TTTThhhheeee tttteeeesssstttt ssssccccrrrriiiipppptttt oooouuuuttttppppuuuutttt
  28.  
  29.      Any output from the testscript to standard error is ignored and bypassed,
  30.      thus will be seen by the user. Lines written to standard output
  31.      containing /^(not\s+)?ok\b/ are interpreted as feedback for _r_u_n_t_e_s_t_s().
  32.      All other lines are discarded.
  33.  
  34.      It is tolerated if the test numbers after ok are omitted. In this case
  35.      Test::Harness maintains temporarily its own counter until the script
  36.      supplies test numbers again. So the following test script
  37.  
  38.          print <<END;
  39.          1..6
  40.          not ok
  41.          ok
  42.          not ok
  43.          ok
  44.          ok
  45.          END
  46.  
  47.      will generate
  48.  
  49.          FAILED tests 1, 3, 6
  50.          Failed 3/6 tests, 50.00% okay
  51.  
  52.      The global variable $Test::Harness::verbose is exportable and can be used
  53.      to let _r_u_n_t_e_s_t_s() display the standard output of the script without
  54.      altering the behavior otherwise.
  55.  
  56.      The global variable $Test::Harness::switches is exportable and can be
  57.      used to set perl command line options used for running the test
  58.      _s_c_r_i_p_t(s). The default value is -w.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))                                              TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))
  71.  
  72.  
  73.  
  74. EEEEXXXXPPPPOOOORRRRTTTT
  75.      &runtests is exported by Test::Harness per default.
  76.  
  77. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  78.      All tests successful.\nFiles=%d,  Tests=%d, %s
  79.          If all tests are successful some statistics about the performance are
  80.          printed.
  81.  
  82.      FAILED tests %s\n\tFailed %d/%d tests, %.2f%% okay.
  83.          For any single script that has failing subtests statistics like the
  84.          above are printed.
  85.  
  86.      Test returned status %d (wstat %d)
  87.          Scripts that return a non-zero exit status, both $? >> 8 and $? are
  88.          printed in a message similar to the above.
  89.  
  90.      Failed 1 test, %.2f%% okay. %s
  91.  
  92.      Failed %d/%d tests, %.2f%% okay. %s
  93.          If not all tests were successful, the script dies with one of the
  94.          above messages.
  95.  
  96. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  97.      See the _B_e_n_c_h_m_a_r_k manpage for the underlying timing routines.
  98.  
  99. AAAAUUUUTTTTHHHHOOOORRRRSSSS
  100.      Either Tim Bunce or Andreas Koenig, we don't know. What we know for sure
  101.      is, that it was inspired by Larry Wall's TEST script that came with perl
  102.      distributions for ages. Numerous anonymous contributors exist. Current
  103.      maintainer is Andreas Koenig.
  104.  
  105. BBBBUUUUGGGGSSSS
  106.      Test::Harness uses $^X to determine the perl binary to run the tests
  107.      with. Test scripts running via the shebang (#!) line may not be portable
  108.      because $^X is not consistent for shebang scripts across platforms. This
  109.      is no problem when Test::Harness is run with an absolute path to the perl
  110.      binary or when $^X can be found in the path.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))                                              TTTTeeeesssstttt::::::::HHHHaaaarrrrnnnneeeessssssss((((3333))))
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.                                                                         PPPPaaaaggggeeee 3333
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.